package com.wing.productionPlan.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wing.enterprise.product.model.entity.ProcessDevice;
import com.wing.productionPlan.model.entity.ProductionProcessDevice;
import com.wing.productionPlan.model.entity.ProductionWorkOrder;
import com.wing.productionPlan.model.response.ProductionProcessDeviceVO;
import com.wing.productionPlan.model.response.ProductionWorkOrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 生产工序设备表-Dao
 *
 * @author
 */
@Mapper
public interface ProductionProcessDeviceDao extends BaseMapper<ProductionProcessDevice> {

    /**
     * 列表-app
     *
     * @param params
     * @return
     */
    List<ProductionProcessDeviceVO> list4app(@Param("params") Map<String, Object> params);

    /**
     * 分页列表-app
     *
     * @param page
     * @param params
     * @return
     */
    List<ProductionProcessDeviceVO> list4app(@Param("page") Page<ProductionProcessDeviceVO> page, @Param("params") Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     * @return
     */
    ProductionProcessDeviceVO get4appById(Long id);

    /**
     * 查询排产设备
     *
     * @return
     */
    List<ProductionProcessDeviceVO> getProductionDeviceByProcessId(@Param("page") Page<ProductionProcessDeviceVO> page
            , @Param("processId") Long processId, @Param("code") String code, @Param("deviceModel") String deviceModel, @Param("deviceName") String deviceName);

    /**
     * 查询计划排产明细工序的设备
     *
     * @param processId
     * @return
     */
    List<ProductionProcessDeviceVO> getProcessDeviceByProcessId(@Param("productionPlanId") Long productionPlanId, @Param("productionPlanRecordId") Long productionPlanRecordId, @Param("processId") Long processId);

    /**
     * 查询工序已排产数量
     *
     * @param processId
     * @param productionPlanId
     * @return
     */
    Integer getSumProductionQuantity(@Param("processId") Long processId, @Param("productionPlanId") Long productionPlanId);

}
